<?php

/**
 * This is the model class for table "luasareaperkebunan".
 *
 * The followings are the available columns in table 'luasareaperkebunan':
 * @property integer $lap_id
 * @property string $lap_jenis
 * @property double $lap_rakyat_area
 * @property double $lap_rakyat_produksi
 * @property double $lap_besar_area
 * @property double $lap_besar_produksi
 * @property double $lap_jumlah_area
 * @property double $lap_jumlah_produksi
 * @property integer $lap_tahun
 */
class Luasareaperkebunan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luasareaperkebunan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luasareaperkebunan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('lap_tahun', 'numerical', 'integerOnly'=>true),
			array('lap_rakyat_area, lap_rakyat_produksi, lap_besar_area, lap_besar_produksi, lap_jumlah_area, lap_jumlah_produksi', 'numerical'),
			array('lap_jenis', 'length', 'max'=>64),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('lap_id, lap_jenis, lap_rakyat_area, lap_rakyat_produksi, lap_besar_area, lap_besar_produksi, lap_jumlah_area, lap_jumlah_produksi, lap_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'lap_id' => 'Lap',
			'lap_jenis' => 'Jenis Tanaman',
			'lap_rakyat_area' => 'Area Per. Rakyat',
			'lap_rakyat_produksi' => 'Produksi Per. Rakyat',
			'lap_besar_area' => 'Area Per. Besar',
			'lap_besar_produksi' => 'Produksi Per. Besar',
			'lap_jumlah_area' => 'Jumlah Area',
			'lap_jumlah_produksi' => 'Jumlah Produksi',
			'lap_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('lap_id',$this->lap_id);
		$criteria->compare('lap_jenis',$this->lap_jenis,true);
		$criteria->compare('lap_rakyat_area',$this->lap_rakyat_area);
		$criteria->compare('lap_rakyat_produksi',$this->lap_rakyat_produksi);
		$criteria->compare('lap_besar_area',$this->lap_besar_area);
		$criteria->compare('lap_besar_produksi',$this->lap_besar_produksi);
		$criteria->compare('lap_jumlah_area',$this->lap_jumlah_area);
		$criteria->compare('lap_jumlah_produksi',$this->lap_jumlah_produksi);
		$criteria->compare('lap_tahun',$this->lap_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}